function getUrlParams() {
    let url = location.href;
    let regExp = /.*\?([^\?]+)/
    let query = {};
    let search = regExp.exec(url);
    search = search[1];
    let searchArr = [];
    if (search.indexOf("&")) {
        searchArr = search.split("&")
    } else {
        search = search.split()
    }
    searchArr.forEach(item => {
        let queryArr = item.split("=");
        query[queryArr[0]] = queryArr[1]
    })
    return query
}
 let section = document.querySelector('.product')
 console.log(section);
let query = getUrlParams()

fetch("http://chst.vip:1234/api/getdiscountproduct?productid="+query.productid)
        .then(body => body.json())
         .then(res => {
             console.log(res.result[0]);
             res =res.result[0]
             let html = `
             <h1>${res.productName}</h1>
             <div class="stext">
             <span>${res.productFrom} | ${res.productTime}</span><i>${res.productTips}</i>
             <p>${res.productPrice}</p>
             </div>
            <div id="cont"><p>
            ${res.productInfo}
            </p></div>
            <div class="big">${res.productImg}</div>

             `;
            section.innerHTML=html
            let html2=`
            ${res.productComment}
            `
            hp.innerHTML=html2
         })